Understanding And Fixing Stack Overflow Errors In Prolog Unit Conversion Programs